package com.xyh;

import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import org.slf4j.LoggerFactory;

import ch.qos.logback.classic.Level;
import ch.qos.logback.classic.Logger;
import ch.qos.logback.classic.LoggerContext;

public class RefreshClient {
    public static void main(String[] args)throws  Exception{
        LoggerContext loggerContext = (LoggerContext) LoggerFactory
                .getILoggerFactory();
        loggerContext.getLogger("root").setLevel(Level.toLevel("INFO"));
        // 创建默认的HttpClient
        CloseableHttpClient httpclient = HttpClients.createDefault();
        // 调用 POST 方法请求服务
        HttpPost httpMethod = new HttpPost("http://localhost:8080/refresh");
        // 获取响应
        HttpResponse response = httpclient.execute(httpMethod);
        // 根据 响应解析出字符串
        System.out.println(EntityUtils.toString(response.getEntity()));
    }
}
